import Request from "./request";

//获取歌单分类
export function getplaylist() {
  return Request({
    url: "/playlist/catlist",
    params: {},
  });
}

//获取推荐歌单
export function getRecplaylist(limit) {
  return Request({
    url: "/personalized",
    params: { limit },
  });
}

//获取精品歌单
export function getBoutique(limit, before) {
  return Request({
    url: "/top/playlist/highquality",
    params: { limit, before },
  });
}

//获取排行榜歌单
export function getRankList() {
  return Request({
    url: "/toplist",
    params: {},
  });
}

//获取网友精选歌单
export function getSelect(limit) {
  return Request({
    url: "/top/playlist",
    params: { limit },
  });
}

//获取分类du对应歌单/top/playlist
export function selectList(cat, limit = 100, offset) {
  return Request({
    url: "/top/playlist",
    params: { cat, limit, offset },
  });
}
//获取歌词
export const getLyric = (params) => {
  return Request({
    url: "/lyric",
    method: "get",
    params,
  });
};

//获取搜索歌曲列表信息
export function getSearchList(keywords, limit, offset, type) {
  return Request({
    url: "/cloudsearch",
    params: {
      keywords,
      limit,
      offset,
      type,
    },
  });
}

//喜欢音乐
export function getMusicLike(id, like) {
  return Request({
    url: "/like",
    params: {
      id,
      like,
    },
  });
}
//收藏歌单
export function getPlayListLike(t, id) {
  return Request({
    url: "/playlist/subscribe",
    params: {
      t,
      id,
    },
  });
}
//获取歌单动态详情
export function getPlayListdynamic(id) {
  return Request({
    url: "/playlist/detail/dynamic",
    params: {
      id,
    },
  });
}

//获取每日推荐
export function getDayMusic() {
  return Request({
    url: "/recommend/songs",
    params: {},
  });
}

//获取私人fm
export function getPraviteFm() {
  return Request({
    url: "/personal_fm",
    params: {},
  });
}

//添加歌曲到歌单
export function getMusicAdd(op, pid, tracks) {
  return Request({
    url: "/playlist/tracks",
    params: {
      op,
      pid,
      tracks,
    },
  });
}

//新建歌单
export function createPlayList(name) {
  return Request({
    url: "/playlist/create",
    params: {
      name,
    },
  });
}

//删除歌单
export function deletePlayList(id) {
  return Request({
    url: "/playlist/delete",
    params: {
      id,
    },
  });
}
